package com.runvp.init;

import com.runvp.service.biz.handler.InitHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * 数据初始化
 * @author xukk_dp
 */
@Order(1)
@Component
public class RunInit implements ApplicationRunner {

    public static final Logger log = LoggerFactory.getLogger(RunInit.class);

    @Autowired
    private InitHandler initHandler;

    @Override
    public void run(ApplicationArguments args)  {
        long st = System.currentTimeMillis();
        log.info("数据异步初始化开始...");
        initHandler.startInit();
        log.info("数据异步初始化结束,共耗时:{}",(System.currentTimeMillis()-st)+" ms");

    }
}
